import {useEffect,useState} from 'react'
import {useDispatch,useSelector} from 'umi'
import { Table, Input, Button,Checkbox  } from 'antd';
import styles from './Search.less'
let columns:any=[
    {
        title:'搜索词',
        dataIndex:'keyword'
    },
    {
        title:'搜索量',
        dataIndex:'count'
    },
    {
        title:'搜索时间',
        dataIndex:'updateAt'
    },
    {
        title:'发送时间',
        dataIndex:'createAt'
    },
    {
        title:'操作',
        render:()=><a>操作</a>
    },
]
const Search:React.FC=()=>{
    const state = useSelector((state:{Search:any}) => state.Search)
    const Dispatch=useDispatch();
    const [dataSource,setDataSource]=useState([])
    const [title,settitle]=useState('')
    useEffect(()=>{
        Dispatch({   
            type:'Search/getsearch'
        })
        setDataSource(state.list[0])
    },[])
    const onButtonClick = () => {
       
    };
    return <div>
        <section className={styles.top}>
            <div className={styles.div}>
            <div>发件人：<Input  placeholder="请输入发件人" value={title} /></div>
            <div>收件人：<Input placeholder="请输入收件人"  /></div>
            <div>主题：<Input placeholder="请输入主题" /></div>
            </div>
            <div className={styles.button}>
            <Button type="primary">搜索</Button>
            <Button onClick={onButtonClick}>重置</Button>
            </div>
        </section>
        <Table rowKey="id" dataSource={dataSource} columns={columns} scroll={{x:1200}}></Table>
        
    </div>
}
export default Search
